package com.netease.financial.base.push;

import android.content.Context;

import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by wyf on 8/7/15.
 */
public class PushEventManager {

    private Map<String, Function> mNotificationPushEventMethodMap;

    private Map<String, Function> mCustomPushEventMethodMap;

    public PushEventManager() {
        mNotificationPushEventMethodMap = new HashMap<>();
        mCustomPushEventMethodMap = new HashMap<>();
    }

    public interface Function {
        void onExecute(Context context, String message, JSONObject jsonObject);
    }

    public void registerNotificationPushEvent(String pushType, Function function) {
        mNotificationPushEventMethodMap.put(pushType, function);
    }

    public Function getFunctionForNotificationPushEvent(String pushType) {
        return mNotificationPushEventMethodMap.get(pushType);
    }

    public void registerCustomPushEvent(String pushType, Function function) {
        mCustomPushEventMethodMap.put(pushType, function);
    }

    public Function getFunctionForCustomPushEvent(String pushType) {
        return mCustomPushEventMethodMap.get(pushType);
    }
}
